package Classes.GameUtils
{
	import Classes.GameDatas.GD_Building_Func;
	import Classes.GameDatas.GD_Building_Sundry;
	import Classes.GameDatas.GD_HavenWall;
	import Classes.GameDatas.GD_MapGrid;
	import Classes.GameDatas.GD_Mission;
	import Classes.GameDatas.GD_Player;
	import Classes.GameViews.GV_Map;
	import Classes.GameViews.ViewDisplayers.MapTargets.MT_Building;
	import Classes.GameViews.ViewDisplayers.MapTargets.MT_Building_Sundry;
	import Classes.GameViews.ViewPanels.VP_Main;
	import Classes.GameViews.ViewPanels.VP_Make;
	import Classes.GameViews.ViewPanels.VP_Mission;
	import Classes.GameViews.ViewPanels.VP_Package;
	import Classes.GameViews.ViewPanels.VP_StorePanel;
	import Classes.GameViews.ViewScenes.VS_Main;
	import Classes.Managers.M_ConfigData;
	import Classes.staticinfo.StaticInfo;
	
	import UIComponents.FlatInfo;
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.system.ApplicationDomain;

	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：May 25, 2012 11:00:33 AM 
	 *  新手指导 处理类
	 */ 
	public class GU_dealPower
	{
		private static var _instance:GU_dealPower; /*静态引用*/
		/**
		 * 新手指导箭头层 
		 */		
		public var arrowLayer:Sprite=VS_Main.instance.newGuidePanel;
		public function GU_dealPower(){}
		
		//箭头命名
		/**
		 *  "firstMisArrow=0","fishFirstMisArrow=1"
		 */		
		public var fisrtStep:Array=["firstMisArrow","fishFirstMisArrow"];
		/**
		 *  clickBuildBtn(0),buybuild(1),buybuild1(2),buybuild2(3),clicksureBtn(4)
		 */		
		public var sencondStep:Array=["clickBuildBtn","buybuild","buybuild1","buybuild2","clicksureBtn"];
		
		/**
		 *  "clickSDBT=0","clickHCBT=1"
		 */		
		public var threeStep:Array=["clickSDBT","clickHCBT"];
		/**
		 *  "clickwqk=0","clickwqksj=1",upWq=2,qhWq=3,"djsdld=4",ZBwq=5,closewqBtn=6
		 */		
		public var fourStep:Array=["clickwqk","clickwqksj","upWq","qhWq","djsdld","ZBwq","closewqBtn"];
		
		/**
		 *  "clickUp=0","clickUPWq=1"
		 */		
		public var fiveStep:Array=["clickUp","clickUPWq"];
		
		/**
		 *  "firendPic=0","visableFirend=1","hireFirend=2",toHome=3
		 */		
		public var sixStep:Array=["firendPic","visableFirend","hireFirend","toHome"];
		
		/**
		 *  "clickCenterBuild=0","kc1=1","kc2=2,kc3=3"
		 */		
		public var sevenStep:Array=["clickCenterBuild","kc1","kc2","kc3"];
		
		/**
		 *  "clickShop=0","buitemWeapon=1"
		 */		
		public var eightStep:Array=["clickShop","buitemWeapon"];
		
		/**
		 *  "clickPackage=0","clickCollect=1",duihua=2
		 */		
		public var nineStep:Array=["clickPackage","clickCollect","duihua"];
		
		/**
		 *  addZW 给杂物加箭头
		 */		
		public var zw:String="addZW"
		
		/**
		 * 保存当前在活动的箭头 
		 */		
		public var arrowObj:Object=new Object();
		
		public static function get instance():GU_dealPower
		{
			if (!_instance)
				_instance=new GU_dealPower();
			return _instance;
		}
		
		/**
		 * 初始化新手指导 
		 */		
		public function initNewGuide():void
		{
			if(GD_Player.instance.missions[11000001])
			{
				GD_HavenWall.inbreakCheck();
			}
			this.clickBuildBtn();
			if(this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006] && GD_Player.instance.getCurrentWeaponByType(11200002))
			{
				this.isUpdateOrDown=true;
				this.clickChangeWeapon();
			}
			loopAddZQTX();	
			if(GD_Player.instance.missions[11000002] && (GD_Player.instance.missions[11000002] as GD_Mission).missionState!="over")
			{
				GU_dealPower.instance.addArrowToZW(this.getSundryServerIDByType(41000004));
			}
		}
		
		public var powObj:Object;
		public function haldNewGuideByPower(power:int):void
		{
			switch(power)
			{
				case 10000217://系统权限---修围墙
					GD_HavenWall.inbreakCheck();
					break;
				
				case 10000204://系统权限---点击任务
//					this.hanldNewMis();
					break;
				case 10000206://系统权限---点击建筑
					clickBuildBtn();
					break; 
				case 10000210://系统权限---雇佣好友
					this.clickFriendFrame();
					break; 
				case 10000207://系统权限---点击研究所
					this.clicksd();
					break;
				case 10000213://系统权限---点击商店
					this.clickShop();
					break;
				case 10000214://系统权限---点击背包
					this.clickPackage();
					break;
				case 10000209://系统权限---拜访好友
					this.clickFriendFrame();
					break;
				case 10000212://中心建筑
					this.clickCenterbuild();
					break;
				case 10000205://采杂物的权限
					GU_dealPower.instance.addArrowToZW(this.getSundryServerIDByType(41000004));
					break;
			}
		}
		
		/**
		 * 根据箭头名字 移除 箭头 
		 * @param arrowName
		 * @param isDelete 是否彻底删除
		 * 
		 */		
		public function removeArrowByArrowName(arrowName:String,isDelete:Boolean=false):void
		{
			if(null==arrowLayer.getChildByName(arrowName))
			{
				return;
			}
			if(isDelete)
			{
				arrowLayer.removeChild(arrowLayer.getChildByName(arrowName));
				delete this.arrowObj[arrowName];
			}else{
				arrowLayer.getChildByName(arrowName).visible=false;
			}
		}
		
		/**
		 * 加上箭头 只能用在死的东西上面  如果是在地图上面的 则拖动地图时
		 * @param arrowName 名字
		 * @param arrowDire 箭头方向 up  down left right
		 * @param rotation  旋转角度
		 * @param parentZB  坐标参考对象
		 */				
		public function addArrowByName(arrowName:String,arrowDire:String="up",rotation:int=0,parentZB:DisplayObject=null):void
		{
			if(this.arrowLayer.getChildByName(arrowName))
			{
				arrowLayer.getChildByName(arrowName).visible=true;
			}else{
				var arrowDis:DisplayObject;
				switch(arrowDire)
				{
					case "up":
						arrowDis=this.getUpArrow();
						if(rotation!=0)
							arrowDis.rotation=rotation;
						break;
					case "down":
						arrowDis=this.getDownArrow();
						if(rotation!=0)
							arrowDis.rotation=rotation;
						break;
					case "left":
						arrowDis=this.getLeftArrow();
						if(rotation!=0)
							arrowDis.rotation=rotation;
						break;
					case "right":
						arrowDis=this.getRightArrow();
						if(rotation!=0)
							arrowDis.rotation=rotation;
						break;
				}
				arrowDis.name=arrowName;//取名字  给 新手层 删除跟增加的时候 找对象用的
				this.powObj=new Object(); //全屏的时候用的
				this.powObj.dxName=arrowName;
				this.powObj.parentZB=parentZB;
				arrowObj[arrowName]=powObj; //新加的箭头加入到箭头对象中，如果是删除 则需要把其从对象中删除
				var dobj:DisplayObject=arrowLayer.addChild(arrowDis);
				var globalPoint:Point=parentZB.localToGlobal(new Point(0,0));
				dobj.x=globalPoint.x;
				dobj.y=globalPoint.y;
			}
		}
		
		/****************单独处理的新手指导   step01*************************/
		
		
		/**
		 * 处理新任务图标 
		 * @param missionType
		 */		
		public function hanldNewMis(missionType:Number=0):void
		{
			if(!this.isHavePower(10000204))
			{
				return;
			}
			this.removeArrowByArrowName(fisrtStep[0],true);
			if(this.arrowLayer.getChildByName(fisrtStep[0]))
				arrowLayer.removeChild(this.arrowLayer.getChildByName(fisrtStep[0]));
			if(this.arrowLayer.getChildByName(fisrtStep[0]))
			{
				arrowLayer.getChildByName(fisrtStep[0]).visible=true;
			}else{
				var firstMisArrow:DisplayObject=this.getLeftArrow();
				firstMisArrow.name=fisrtStep[0];
				this.powObj=new Object();
				this.powObj.dxName=fisrtStep[0];
				arrowObj[fisrtStep[0]]=powObj;
				var dobj:DisplayObject=arrowLayer.addChild(firstMisArrow);
				dobj.name=fisrtStep[0];
				dobj.x=77;
				dobj.y=153;
				dobj.visible=true;
			}
		
		}
		
		/**
		 *  
		 *  隐藏任务上面的的箭头
		 */		
		public function hideMisNewGuide(isDelete:Boolean=false):void
		{
			if(null==arrowLayer.getChildByName(fisrtStep[0]))return;
			arrowLayer.getChildByName(fisrtStep[0]).visible=false;
			if(isDelete)
			{
				arrowLayer.removeChild(arrowLayer.getChildByName(fisrtStep[0]));
			}
		}
		
		/**
		 * 打开任务面板时候 
		 * @param missionType
		 */		
		public function hanldMission(missionType:Number):void
		{
			var mbdx:DisplayObject=VP_Mission.instance.interfaceUI["missFinish"];

			if(isNewGuideMis(missionType))//missionType==11000001
			{
				//				GU_dealPower.instance.addArrowByName(GU_dealPower.instance.fisrtStep[1],"down",0,VP_Mission.instance.interfaceUI["missFinish"]);
				if(null==mbdx.parent.getChildByName(this.fisrtStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.fisrtStep[1];
				}else{
					mbdx.parent.getChildByName(this.fisrtStep[1]).visible=true;
				}
				this.removeArrowByArrowName(this.fisrtStep[0]);
			}else{
				if(mbdx.parent.getChildByName(this.fisrtStep[1]))
				{
					mbdx.parent.removeChild(mbdx.parent.getChildByName(this.fisrtStep[1]));
				}
			}
//			if(missionType==11000001 && (GD_Player.instance.missions[11000001] as GD_Mission).missionState!="over")
//			{
//				GD_HavenWall.inbreakCheck();
//			}
			dealMis(missionType);
		}
		
		public function dealMis(missionType:Number):void
		{
			switch(missionType)
			{
				case 11000001://打僵尸 休篱笆
					if((GD_Player.instance.missions[11000001] as GD_Mission).missionState=="over")
					{
						GD_HavenWall.inbreakCheck();
						GD_HavenWall.setIsInbreak(false);
					}
					break;
				case 11000004://危险作业  闪电研究室合成
					if((GD_Player.instance.missions[11000004] as GD_Mission).missionState=="over")
					{
						this.removeSDArrow();
					}else{
						GU_dealPower.instance.clicksd();
					}
					break;
				case 11000005:
					if((GD_Player.instance.missions[11000005] as GD_Mission).missionState=="over")
					{
						this.removeWQKArrow();
					}else{
						GU_dealPower.instance.clickwqk();
					}
					break;
				case 11000006://武器库
					if((GD_Player.instance.missions[11000006] as GD_Mission).missionState=="over")
					{
						this.removeWQKArrow();
						this.removePartArrowForUPorDown();
						FlatInfo.newGuiderQHWq=false;
					}else if(null!=GD_Player.instance.getCurrentWeaponByType(11200002)){
						FlatInfo.newGuiderQHWq=true;
						this.removeWQKArrow();
						this.clickChangeWeapon();
					}else{
						GU_dealPower.instance.clickwqk();
						FlatInfo.newGuiderQHWq=true;
					}
					break;
				case 11000007://好友
					if((GD_Player.instance.missions[11000007] as GD_Mission).missionState=="over")
					{
						//移除好友有关的箭头
						this.removeArrowForFriend();
					}else{
						GU_dealPower.instance.clickFriendFrame();
					}
					break;
				case 11000009://安全领地 中心建筑
					if((GD_Player.instance.missions[11000009] as GD_Mission).missionState=="over")
					{
						//移除中心建筑有关的箭头
						this.removeCenterBuild();
						
					}else{
						this.clickCenterbuild();
					}
					break;
				case 11000010://商店
					if((GD_Player.instance.missions[11000010] as GD_Mission).missionState=="over")
					{
						//移除商店有关的箭头
						this.removeShopArrow();
						VP_StorePanel.instance.close(false);
					}else{
						this.clickShop();
					}
					break;
				case 11000012://背包
					if((GD_Player.instance.missions[11000012] as GD_Mission).missionState=="over")
					{
						//移除背包有关的箭头
						this.removePackageArrow();
						VP_Package.instance.close(false);
					}else{
						this.clickPackage();
					}
					break;
			}
		}
		
		/**
		 *  点击x 关闭面板的时候 
		 * @param missionType
		 */		
		public function hanldCloseMiss(missionType:Number):void
		{
			var mbdx:DisplayObject=VP_Mission.instance.interfaceUI["missFinish"];
			if(mbdx.parent.getChildByName(this.fisrtStep[1]))
			{
//				mbdx.parent.removeChild(mbdx.parent.getChildByName(this.fisrtStep[1]));
				mbdx.parent.getChildByName(this.fisrtStep[1]).visible=false;
			}
//			if(missionType==11000001)//任务图标上面再次上线箭头
//			{
//				this.addArrowByName(this.fisrtStep[0])
//			}
		}
		
		public function hanldFishMiss(missionType:Number):void
		{
			this.removeArrowByArrowName(this.fisrtStep[0],true);
		}
		
		
		/****************单独处理的新手指导   step02*************************/
		
		
		//点击建筑
		public function clickBuildBtn():void
		{
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000206) && null!=GD_Player.instance.missions[11000003] && (!GD_deal.instance.isOwnbuildInMap(40102001) || !GD_deal.instance.isOwnbuildInMap(40106001)))
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["button_building"];
				if(null==mbdx.parent.getChildByName(this.sencondStep[0]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.sencondStep[0];
				}else{
					mbdx.parent.getChildByName(this.sencondStep[0]).visible=true;
				}
			}
		}
		
		//点击里面建筑
		public function buyBuildstep():void
		{
			//拥有此权限的同时拥有此任务
			this.removeArrowByArrowNameInParent(this.sencondStep[0],false,(VP_Main.instance.interfaceUI["button_building"] as DisplayObject).parent);
			if(this.isHavePower(10000206) && null!=GD_Player.instance.missions[11000003] && (!GD_deal.instance.isOwnbuildInMap(40102001) || !GD_deal.instance.isOwnbuildInMap(40106001)))
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["_panelBuild"]["button_building"];
				if(null==mbdx.parent.getChildByName(this.sencondStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.sencondStep[1];
				}else{
					mbdx.parent.getChildByName(this.sencondStep[1]).visible=true;
				}
			}
			
		}
		
		//购买建筑
		public function buyJTBuild():void
		{
			this.removeArrowByArrowNameInParent(this.sencondStep[1],false,(VP_Main.instance.interfaceUI["_panelBuild"]["button_building"] as DisplayObject).parent);
			if(this.isHavePower(10000206) && null!=GD_Player.instance.missions[11000003])
			{
				if(!GD_deal.instance.isOwnbuildInMap(40102001))
				{
					var mbdx:DisplayObject=VP_Main.instance.interfaceUI["buildBuyItem1"];
					this.addArrowInParent(mbdx,this.sencondStep[2],"down");
				}
				
				if(!GD_deal.instance.isOwnbuildInMap(40106001))
				{
					var mbdx2:DisplayObject=VP_Main.instance.interfaceUI["buildBuyItem5"];
					this.addArrowInParent(mbdx2,this.sencondStep[3],"down");
				}
			}
		}
		//点确定
		private var button_sureY:Number=0;
		private var button_sureX:Number=0;
		public function sureBuild():void
		{
			if(GD_deal.instance.isOwnbuildInMap(40102001) && GD_deal.instance.isOwnbuildInMap(40106001))
			{
				this.removeArrowByArrowNameInParent(this.sencondStep[2],false,(VP_Main.instance.interfaceUI["buildBuyItem1"] as DisplayObject).parent);	
				this.removeArrowByArrowNameInParent(this.sencondStep[3],false,(VP_Main.instance.interfaceUI["buildBuyItem5"] as DisplayObject).parent);
			}else if(!GD_deal.instance.isOwnbuildInMap(40102001) && GD_deal.instance.isOwnbuildInMap(40106001))
			{
				this.removeArrowByArrowNameInParent(this.sencondStep[3],false,(VP_Main.instance.interfaceUI["buildBuyItem5"] as DisplayObject).parent);	
			}else if(GD_deal.instance.isOwnbuildInMap(40102001) && !GD_deal.instance.isOwnbuildInMap(40106001))
			{
				this.removeArrowByArrowNameInParent(this.sencondStep[2],false,(VP_Main.instance.interfaceUI["buildBuyItem1"] as DisplayObject).parent);
			}
			
			if(this.isHavePower(10000206) && null!=GD_Player.instance.missions[11000003] && (GD_deal.instance.isOwnbuildInMap(40102001) && GD_deal.instance.isOwnbuildInMap(40106001)))
			{
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["button_sure"];
				this.addArrowInParent(mbdx,this.sencondStep[4],"up",20);
				var dis:DisplayObject=mbdx.parent.getChildByName(this.sencondStep[4]);
				if(button_sureY==0 || button_sureX==0)
				{
					button_sureY=dis.y+40;
					button_sureX=dis.x-17;
				}
				dis.y=button_sureY;
				dis.x=button_sureX;
			}
		}
		
		/**
		 * 点击确定的时候移除前面的箭头 
		 */		
		public function removeBuildArrow():void
		{
			this.removeArrowByArrowNameInParent(this.sencondStep[1],false,(VP_Main.instance.interfaceUI["_panelBuild"]["button_building"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sencondStep[2],false,(VP_Main.instance.interfaceUI["buildBuyItem1"] as DisplayObject).parent);	
			this.removeArrowByArrowNameInParent(this.sencondStep[3],false,(VP_Main.instance.interfaceUI["buildBuyItem5"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sencondStep[4],false,(VP_Main.instance.interfaceUI["button_sure"] as DisplayObject).parent);
		}
		
		/**
		 * 循环给杂物加上箭头 
		 */		
		private function loopAddZQTX():void
		{
			for each(var sundryData:GD_Building_Sundry in GD_Player.instance.mapData.sundriesObj)
			{
				if(sundryData.zt_other_type==30000023)
				{
					this.addArrowToZW(sundryData.serverID);	
				}
			}
		}
		
		
		//处理杂物
		public function addArrowToZW(sundryId:int):void
		{
			if(this.isHavePower(10000205))
			{
				var mbdx:MT_Building_Sundry=this.getSundryView(sundryId);
				
				if(null==mbdx)return;
				var ds:DisplayObject=mbdx.getChildByName(this.zw);
				if(null==mbdx.getChildByName(this.zw))
				{
					if(!mbdx.buildingSundryData.isFloor)
					{
						var dis:DisplayObject=mbdx.addChild(this.getDownArrow());
						dis.name=this.zw;
						dis.y-=40;
						if(GD_deal.instance.getStr(mbdx.buildingSundryData.sundryType)==StaticInfo.NPC_SUNDRY_TYPE)
						{
							dis.y-=30;
						}
					}else{
						mbdx.setState(10002000,true);
					}
					
//					if(mbdx.buildingSundryData.isFloor){
//						dis.y+=35;
//					}
				}else{
					mbdx.getChildByName(this.zw).visible=true;
				}
			}
		}
		
		/****************单独处理的闪电研究室   step03*************************/
		
		//闪电研究室
		/**
		 * 闪电 研究室出现箭头
		 */		
		public function clicksd():void
		{
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000207) && null!=GD_Player.instance.missions[11000004])
			{
				var mbdx:MT_Building=this.getMtView(40102001);
			
				if(null==mbdx)return;
				var ds:DisplayObject=mbdx.getChildByName(this.threeStep[0]);
				if(null==mbdx.getChildByName(this.threeStep[0]))
				{
					var dis:DisplayObject=mbdx.addChild(this.getDownArrow());
					dis.name=this.threeStep[0];
					dis.y-=80;
				}else{
					mbdx.getChildByName(this.threeStep[0]).visible=true;
				}
			}
		}
		
		/**
		 * 点击闪电合成 
		 */		
		public function clicksdHc():void
		{
			if(this.isHavePower(10000207) && null!=GD_Player.instance.missions[11000004] && (GD_Player.instance.missions[11000004] as GD_Mission).missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["mkBtnForArrow"];
				if(null==mbdx.parent.getChildByName(this.threeStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.threeStep[1];
				}else{
					mbdx.parent.getChildByName(this.threeStep[1]).visible=true;
				}
			}
		}
		
		public function removeSDArrow():void
		{
			this.removeArrowByArrowNameInParent(this.threeStep[0],false,this.getMtView(40102001));
			this.removeArrowByArrowNameInParent(this.threeStep[1],true,(VP_Make.instance.interfaceUI["mkBtnForArrow"] as DisplayObject).parent);
		}
		
		/****************单独处理的物武器库   step04*************************/
		//物武器库
		/**
		 * 物武器库出现箭头
		 */		
		public function clickwqk():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[1],true,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[2],true,(VP_Make.instance.interfaceUI["upBtnForArrow"] as DisplayObject).parent);
			//拥有此权限的同时拥有此任务
//			if(this.isHavePower(10000211) && null!=GD_Player.instance.missions[11000005])
//			{
			var mbdx:MT_Building=this.getMtView(40106001);
			
			if(null==mbdx)return;
			var ds:DisplayObject=mbdx.getChildByName(this.fourStep[0]);
			if(null==mbdx.getChildByName(this.fourStep[0]))
			{
				var dis:DisplayObject=mbdx.addChild(this.getDownArrow());
				dis.name=this.fourStep[0];
				dis.y-=40;
			}else{
				mbdx.getChildByName(this.fourStep[0]).visible=true;
			}
//			}
		}
		/**
		 * 点击武器升级
		 */		
		public function clickwqksj():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[1],false,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[2],false,(VP_Make.instance.interfaceUI["upBtnForArrow"] as DisplayObject).parent);
			if(this.isHavePower(10000211) && null!=GD_Player.instance.missions[11000005] &&(GD_Player.instance.missions[11000005] as GD_Mission).missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["upBtn"];
				if(null==mbdx.parent.getChildByName(this.fourStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getUpArrow());
					dis.x=mbdx.x+mbdx.width/2-12;
					dis.y=mbdx.y+mbdx.height+3;
					dis.name=this.fourStep[1];
				}else{
					mbdx.parent.getChildByName(this.fourStep[1]).visible=true;
				}
			}
		}
		
	
		
		/**
		 * 升级武器 
		 */		
		public function clickUpbuilidBtn():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[1],false,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
			if(this.isHavePower(10000211) && null!=GD_Player.instance.missions[11000005]&& (GD_Player.instance.missions[11000005] as GD_Mission).missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["upBtnForArrow"];
				if(null==mbdx.parent.getChildByName(this.fourStep[2]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.fourStep[2];
				}else{
					mbdx.parent.getChildByName(this.fourStep[2]).visible=true;
				}
			}
		}
		
//		private function removeWqArrow():void
//		{
//			this.removeArrowByArrowNameInParent(this.fourStep[0],true,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
//			this.removeArrowByArrowNameInParent(this.fourStep[1],true,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
//			this.removeArrowByArrowNameInParent(this.fourStep[2],true,(VP_Make.instance.interfaceUI["upBtnForArrow"] as DisplayObject).parent);
//		}
		
		/**
		 * 点击武器切换
		 */		
		public function clickwqkqh():void
		{
			if(this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["wuButton"];
				if(null==mbdx.parent.getChildByName(this.fourStep[3]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2-12;
					dis.y=mbdx.y-10;
					dis.name=this.fourStep[3];
				}else{
					mbdx.parent.getChildByName(this.fourStep[3]).visible=true;
				}
			}
		}
		
		/**
		 * 点击切换闪电镰刀(点击按钮)
		 */		
		public function clickDJBtn():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[3],true,(VP_Make.instance.interfaceUI["wuButton"] as DisplayObject).parent);
			if(this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["djBtn"];
				if(null==mbdx.parent.getChildByName(this.fourStep[4]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.fourStep[4];
				}else{
					mbdx.parent.getChildByName(this.fourStep[4]).visible=true;
				}
			}
		}
		
		
		/**
		 * 点击被切换的闪电镰刀
		 */		
		public function clickSDld():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[4],true,(VP_Make.instance.interfaceUI["djBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[5],true,(VP_Make.instance.interfaceUI["sdldFrame"] as DisplayObject).parent);
			if((VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent.getChildByName(fourStep[6]) && (VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent.getChildByName(fourStep[6]).visible)
			{
				return;
			}
			if(this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006] && null==GD_Player.instance.getCurrentWeaponByType(11200002))
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["sdldFrame"];
				if(null==mbdx.parent.getChildByName(this.fourStep[5]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.fourStep[5];
				}else{
					mbdx.parent.getChildByName(this.fourStep[5]).visible=true;
				}
			}
		}
		
		/**
		 * 点击关闭武器库
		 */		
		public function clickWqkClose():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[4],true,(VP_Make.instance.interfaceUI["djBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[5],true,(VP_Make.instance.interfaceUI["sdldFrame"] as DisplayObject).parent);
			if(this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Make.instance.interfaceUI["closeBtn"];
				if(null==mbdx.parent.getChildByName(this.fourStep[6]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.fourStep[6];
				}else{
					mbdx.parent.getChildByName(this.fourStep[6]).visible=true;
				}
				isUpdateOrDown=true;
			}
		}
		
		
		/**
		 * 移除武器库上面 的箭头 
		 */		
		public function removeWQKArrow():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[0],false,this.getMtView(40106001));
			this.removeArrowByArrowNameInParent(this.fourStep[1],true,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[2],true,(VP_Make.instance.interfaceUI["upBtnForArrow"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[3],true,(VP_Make.instance.interfaceUI["wuButton"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[4],true,(VP_Make.instance.interfaceUI["djBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[5],true,(VP_Make.instance.interfaceUI["sdldFrame"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[6],true,(VP_Make.instance.interfaceUI["closeBtn"] as DisplayObject).parent);
		}
		/**
		 * 移除武器库上面 的部分箭头 
		 */	
		public function removePartArrowForWenpon():void
		{
			this.removeArrowByArrowNameInParent(this.fourStep[1],true,(VP_Make.instance.interfaceUI["upBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[2],true,(VP_Make.instance.interfaceUI["upBtnForArrow"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[3],true,(VP_Make.instance.interfaceUI["wuButton"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[4],true,(VP_Make.instance.interfaceUI["djBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[5],true,(VP_Make.instance.interfaceUI["sdldFrame"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fourStep[6],true,(VP_Make.instance.interfaceUI["closeBtn"] as DisplayObject).parent);
		}
		
		
		/****************单独处理的切换武器在左下角  step05*************************/
			
		/**
		 * 控制下面的武器 选中的标志 
		 */		
		private var isUpdateOrDown:Boolean=false;
		/**
		 * 点击切换武器的伸缩按钮 
		 */		
		public function clickChangeWeapon():void
		{
//			if(null==GD_Player.instance.getCurrentWeaponByType(11200002))return;
			if(isUpdateOrDown && this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006] && (GD_Player.instance.missions[11000006] as GD_Mission).missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["upOrDownBtn"];
				if(null==mbdx.parent.getChildByName(this.fiveStep[0]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-6;
					dis.name=this.fiveStep[0];
				}else{
					mbdx.parent.getChildByName(this.fiveStep[0]).visible=true;
				}
			}
			newGuideWeapon();
		}
		
		/**
		 * 点击需要切换的具体武器 
		 */		
		public function  clickJTWeapon():void
		{
			if(null==GD_Player.instance.getCurrentWeaponByType(11200002))return;
			this.removeArrowByArrowNameInParent(this.fiveStep[0],true,(VP_Main.instance.interfaceUI["upOrDownBtn"] as DisplayObject).parent);
			if(isUpdateOrDown && this.isHavePower(10000208) && null!=GD_Player.instance.missions[11000006])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["selectWeaponInnerPanel2"];
				if(null==mbdx.parent.getChildByName(this.fiveStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-6;
					dis.name=this.fiveStep[1];
				}else{
					mbdx.parent.getChildByName(this.fiveStep[1]).visible=true;
				}
				this.isUpdateOrDown=false;
			}
		}
		
		/**
		 * 移除更换武器的部分箭头  
		 */	
		public function removePartArrowForUPorDown():void
		{
			this.removeArrowByArrowNameInParent(this.fiveStep[0],true,(VP_Main.instance.interfaceUI["upOrDownBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.fiveStep[1],true,(VP_Main.instance.interfaceUI["selectWeaponInnerPanel2"] as DisplayObject).parent);
		}
		
        public function newGuideWeapon():void
		{
			//设置武器库切换
			if(isHavePower(10000208) && null!=GD_Player.instance.missions[11000006] && (GD_Player.instance.missions[11000006] as GD_Mission).missionState!="over")
			{
				FlatInfo.newGuiderQHWq=true;
			}else{
				FlatInfo.newGuiderQHWq=false;
			}
		}
		
		/****************单独处理的好友指导  step06*************************/
		
		/**
		 * 是否在好友家
		 */		
		public var isInFriendHome:Boolean=false;
		/**
		 * 是否选择了好友 
		 */		
		public var isSelectFriend:Boolean=false;
		
		/**
		 * 箭头出现在好友头像上面 
		 */		
		public function clickFriendFrame():void
		{
			this.removeArrowByArrowNameInParent(this.sixStep[1],true,(VP_Main.instance.interfaceUI["friendVisableBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[2],true,(VP_Main.instance.interfaceUI["friendFireBtn"] as DisplayObject).parent);
			var s:int=GD_Player.instance.character.characterState;
			if(!isInFriendHome && !isSelectFriend && GD_Player.instance.character.characterState==0 && (this.isHavePower(10000209) ||this.isHavePower(10000210))  && null!=GD_Player.instance.missions[11000007] && GD_Player.instance.missions[11000007].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["friendFrame2"];
				if(null==mbdx.parent.getChildByName(this.sixStep[0]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-6;
					dis.name=this.sixStep[0];
				}else{
					mbdx.parent.getChildByName(this.sixStep[0]).visible=true;
				}
			}
		}
		
		/**
		 *  拜访  系统权限---拜访好友--10000209(里面也包含了 雇佣的代码哦)
		 */		
		public function clickFriendBtn():void
		{
//			removeArrowForFriend();
			this.removeArrowByArrowNameInParent(this.sixStep[0],true,(VP_Main.instance.interfaceUI["friendFrame2"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[1],true,(VP_Main.instance.interfaceUI["friendVisableBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[2],true,(VP_Main.instance.interfaceUI["friendFireBtn"] as DisplayObject).parent);
			if(GD_Player.instance.missions[11000007] && GD_Player.instance.missions[11000007].missionState=="over" && isInFriendHome && isSelectFriend)return;
			if(GD_Player.instance.character.characterState==0 && this.isHavePower(10000209) && !this.isHavePower(10000210)  && null!=GD_Player.instance.missions[11000007])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["friendVisableBtn"];
				if(null==mbdx.parent.getChildByName(this.sixStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-2;
					dis.name=this.sixStep[1];
				}else{
					mbdx.parent.getChildByName(this.sixStep[1]).visible=true;
				}
			}else{
				clickFireFriend();
			}
		}
		
		/**
		 *  雇佣  系统权限---雇佣好友--10000210
		 */		
		private function clickFireFriend():void
		{
			if(GD_Player.instance.character.characterState==0 && GD_Player.instance.character.characterState==0 && this.isHavePower(10000209) && this.isHavePower(10000210)  && null!=GD_Player.instance.missions[11000007])
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["friendFireBtn"];
				if(null==mbdx.parent.getChildByName(this.sixStep[2]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-2;
					dis.name=this.sixStep[2];
				}else{
					mbdx.parent.getChildByName(this.sixStep[2]).visible=true;
				}
			}
		}
		
		/**
		 *  回家的箭头
		 */		
		public function clickGoHome():void
		{
			this.removeArrowByArrowNameInParent(this.sixStep[0],true,(VP_Main.instance.interfaceUI["friendFrame2"] as DisplayObject).parent);
			if(null!=GD_Player.instance.missions[11000007] && GD_Player.instance.missions[11000007].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["goHomeBtn"];
				if(null==mbdx.parent.getChildByName(this.sixStep[3]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-2;
					dis.name=this.sixStep[3];
				}else{
					mbdx.parent.getChildByName(this.sixStep[3]).visible=true;
				}
			}
		}
		
		
		/**
		 * 移除好友箭头  
		 */	
		public function removeArrowForFriend():void
		{
			this.removeArrowByArrowNameInParent(this.sixStep[0],true,(VP_Main.instance.interfaceUI["friendFrame2"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[1],true,(VP_Main.instance.interfaceUI["friendVisableBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[2],true,(VP_Main.instance.interfaceUI["friendFireBtn"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.sixStep[3],true,(VP_Main.instance.interfaceUI["goHomeBtn"] as DisplayObject).parent);
		}
		
		
		/****************单独处理的中心建筑   step07*************************/
		
		//中心建筑 
		/**
		 * 中心建筑 出现箭头
		 */		
		public function clickCenterbuild():void
		{
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000212) && null!=GD_Player.instance.missions[11000009])
			{
				var mbdx:MT_Building=this.getMtView(40101001);
				
				if(null==mbdx)return;
				var ds:DisplayObject=mbdx.getChildByName(this.sevenStep[0]);
				if(null==mbdx.getChildByName(this.sevenStep[0]))
				{
					var dis:DisplayObject=mbdx.addChild(this.getDownArrow());
					dis.name=this.sevenStep[0];
					dis.y-=62;
				}else{
					mbdx.getChildByName(this.sevenStep[0]).visible=true;
				}
			}
		}
		
		/**
		 * 点击扩地按钮 
		 */		
		public function clickCK():void
		{
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000212) && null!=GD_Player.instance.missions[11000009] && GD_Player.instance.missions[11000009].missionState!="over")
			{
				//加入箭头
//				var mbdx1:DisplayObject=VP_Make.instance.interfaceUI["obkjBtn"];
				var mbdx2:DisplayObject=VP_Make.instance.interfaceUI["jbkjBtn"];
//				var mbdx3:DisplayObject=VP_Make.instance.interfaceUI["friendkjBtn"];
//				if(null==mbdx1.parent.getChildByName(this.sevenStep[1]))
//				{
//					var dis:DisplayObject=mbdx1.parent.addChild(this.getRightArrow());
//					dis.x=mbdx1.x-4;
//					dis.y=mbdx1.y+mbdx1.height/2;
//					dis.name=this.sevenStep[1];
//				}else{
//					mbdx1.parent.getChildByName(this.sevenStep[1]).visible=true;
//				}
//				
				if(null==mbdx2.parent.getChildByName(this.sevenStep[2]))
				{
					var dis2:DisplayObject=mbdx2.parent.addChild(this.getRightArrow());
					dis2.x=mbdx2.x-4;
					dis2.y=mbdx2.y+mbdx2.height/2;
					dis2.name=this.sevenStep[2];
				}else{
					mbdx2.parent.getChildByName(this.sevenStep[2]).visible=true;
				}
				
//				if(null==mbdx3.parent.getChildByName(this.sevenStep[3]))
//				{
//					var dis3:DisplayObject=mbdx3.parent.addChild(this.getRightArrow());
//					dis3.x=mbdx3.x-4;
//					dis3.y=mbdx3.y+mbdx3.height/2;
//					dis3.name=this.sevenStep[3];
//				}else{
//					mbdx3.parent.getChildByName(this.sevenStep[3]).visible=true;
//				}
			}
		}
		
		
		
		/**
		 * 移除中心建筑箭头  
		 */	
		public function removeCenterBuild():void
		{
			if(this.isHavePower(10000212) && null!=GD_Player.instance.missions[11000009])
			{
				this.removeArrowByArrowNameInParent(this.sevenStep[0],true,this.getMtView(40101001));
//				this.removeArrowByArrowNameInParent(this.sevenStep[1],true,(VP_Make.instance.interfaceUI["obkjBtn"] as DisplayObject).parent);
				this.removeArrowByArrowNameInParent(this.sevenStep[2],true,(VP_Make.instance.interfaceUI["jbkjBtn"] as DisplayObject).parent);
//				this.removeArrowByArrowNameInParent(this.sevenStep[3],true,(VP_Make.instance.interfaceUI["friendkjBtn"] as DisplayObject).parent);
			}
		}
		
		/****************单独处理的商店   step08*************************/
		//点击商店
		public function clickShop():void
		{
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000213) && null!=GD_Player.instance.missions[11000010] && GD_Player.instance.missions[11000010].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["button_shop"];
				if(null==mbdx.parent.getChildByName(this.eightStep[0]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.eightStep[0];
				}else{
					mbdx.parent.getChildByName(this.eightStep[0]).visible=true;
				}
			}
			
		}
		
		/**
		 * 在商店购买武器 
		 */		
		public function clickBuyWeapon():void
		{
//			this.removeArrowByArrowNameInParent(this.eightStep[0],true,(VP_Main.instance.interfaceUI["button_shop"] as DisplayObject).parent);
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000213) && null!=GD_Player.instance.missions[11000010] && GD_Player.instance.missions[11000010].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_StorePanel.instance.interfaceUI["shopItemFrame1"];
				if(null==mbdx.parent.getChildByName(this.eightStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getRightArrow());
					dis.x=mbdx.x+20;
					dis.y=mbdx.y+116;
					dis.name=this.eightStep[1];
				}else{
					mbdx.parent.getChildByName(this.eightStep[1]).visible=true;
				}
			}
		}
		
		public function removeShopArrow():void
		{
			this.removeArrowByArrowNameInParent(this.eightStep[0],true,(VP_Main.instance.interfaceUI["button_shop"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.eightStep[1],true,(VP_StorePanel.instance.interfaceUI["shopItemFrame1"] as DisplayObject).parent);
		}
		
		/**
		 * 是否在做商店的新手指导 
		 */		
		public function newGuideshop():void
		{
			//设置武器库切换
			if(this.isHavePower(10000213) && null!=GD_Player.instance.missions[11000010] && (GD_Player.instance.missions[11000010] as GD_Mission).missionState!="over")
			{
				FlatInfo.newGuiderShop=true;
			}else{
				FlatInfo.newGuiderShop=false;
			}	
		}
		
		/****************单独处理的背包   step09*************************/
		
		//点击背包
		public function clickPackage():void
		{
			//拥有此权限的同时拥有此任务
			this.removeArrowByArrowNameInParent(this.nineStep[1],true,(VP_Package.instance.interfaceUI["_button_collect"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.nineStep[1],true,(VP_Package.instance.interfaceUI["duihuaBtn"] as DisplayObject).parent);
			if(this.isHavePower(10000214) && null!=GD_Player.instance.missions[11000012] && GD_Player.instance.missions[11000012].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Main.instance.interfaceUI["button_package"];
				if(null==mbdx.parent.getChildByName(this.nineStep[0]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.nineStep[0];
				}else{
					mbdx.parent.getChildByName(this.nineStep[0]).visible=true;
				}
			}
			
		}
		
		/**
		 * 在背包里面的收藏按钮
		 */		
		public function clickCollectBtn():void
		{
//			this.removeArrowByArrowNameInParent(this.nineStep[0],true,(VP_Main.instance.interfaceUI["button_package"] as DisplayObject).parent);
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000214) && null!=GD_Player.instance.missions[11000012] && GD_Player.instance.missions[11000012].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Package.instance.interfaceUI["_button_collect"];
				if(null==mbdx.parent.getChildByName(this.nineStep[1]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.nineStep[1];
				}else{
					mbdx.parent.getChildByName(this.nineStep[1]).visible=true;
				}
			}
		}
		
		/**
		 * 点击兑换 
		 */		
		public function clickDHCollectBtn():void
		{
			this.removeArrowByArrowNameInParent(this.nineStep[1],true,(VP_Package.instance.interfaceUI["_button_collect"] as DisplayObject).parent);
			//拥有此权限的同时拥有此任务
			if(this.isHavePower(10000214) && null!=GD_Player.instance.missions[11000012] && GD_Player.instance.missions[11000012].missionState!="over")
			{
				//加入箭头
				var mbdx:DisplayObject=VP_Package.instance.interfaceUI["duihuaBtn"];
				if(null==mbdx.parent.getChildByName(this.nineStep[2]))
				{
					var dis:DisplayObject=mbdx.parent.addChild(this.getDownArrow());
					dis.x=mbdx.x+mbdx.width/2;
					dis.y=mbdx.y-10;
					dis.name=this.nineStep[2];
				}else{
					mbdx.parent.getChildByName(this.nineStep[2]).visible=true;
				}
			}
		}
		
		public function removePackageArrow():void
		{
			this.removeArrowByArrowNameInParent(this.nineStep[0],true,(VP_Main.instance.interfaceUI["button_package"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.nineStep[1],true,(VP_Package.instance.interfaceUI["_button_collect"] as DisplayObject).parent);
			this.removeArrowByArrowNameInParent(this.nineStep[2],true,(VP_Package.instance.interfaceUI["duihuaBtn"] as DisplayObject).parent);
		}
		
		
		//独立的方法跟上面调用
		
		private function getMtView(zt_fun_id:Number):MT_Building
		{
			var mbdx:MT_Building
			if(GD_Player.instance.character.characterState==0 && GD_Player.instance.mapData)
			{
				for each (var gd2:GD_Building_Func in GD_Player.instance.mapData.buildingsObj)
				{
					if(gd2.buildingType==zt_fun_id)
					{
						mbdx=gd2.view;
						break;
					}
				}
			}
			return mbdx;
		}
		
		/**
		 * 获取杂物视图 
		 * @param serverID
		 * @return 
		 */		
		private function getSundryView(serverID:Number):MT_Building_Sundry
		{
			var mbdx:MT_Building_Sundry
			if(GD_Player.instance.character.characterState==0 && GD_Player.instance.mapData)
			{
				for each (var gd2:GD_Building_Sundry in GD_Player.instance.mapData.sundriesObj)
				{
					if(gd2.serverID==serverID)
					{
						mbdx=gd2.view;
						break;
					}
				}
			}
			return mbdx;
		}
		
		/**
		 * 获取杂物视图 序列ID
		 * @param serverID
		 * @return 
		 */		
		private function getSundryServerIDByType(sundryType:Number):int
		{
			var mbdx:int=0;
			if(GD_Player.instance.character.characterState==0 && GD_Player.instance.mapData)
			{
				for each (var gd2:GD_Building_Sundry in GD_Player.instance.mapData.sundriesObj)
				{
					if(gd2.sundryType==sundryType)
					{
						mbdx=gd2.serverID;
						break;
					}
				}
			}
			return mbdx;
		}
		
		/**
		 * 增加箭头 在父容器中 
		 * @param mbdx  需要增加箭头的对象
		 * @param stepName 步骤名字
		 * @param fx  箭头方向
		 * @param rotation 箭头旋转角度
		 */		
		private function addArrowInParent(mbdx:DisplayObject,stepName:String,fx:String,rotation:int=0):void
		{
			var arrowDis:DisplayObject;
			switch(fx)
			{
				case "up":
					arrowDis=this.getUpArrow();
					if(rotation!=0)
						arrowDis.rotation=rotation;
					break;
				case "down":
					arrowDis=this.getDownArrow();
					if(rotation!=0)
						arrowDis.rotation=rotation;
					break;
				case "left":
					arrowDis=this.getLeftArrow();
					if(rotation!=0)
						arrowDis.rotation=rotation;
					break;
				case "right":
					arrowDis=this.getRightArrow();
					if(rotation!=0)
						arrowDis.rotation=rotation;
					break;
			}
			if(null==mbdx.parent.getChildByName(stepName))
			{
				var dis:DisplayObject=mbdx.parent.addChild(arrowDis);
				dis.x=mbdx.x+mbdx.width/2;
				dis.y=mbdx.y-10;
				dis.name=stepName;
			}else{
				mbdx.parent.getChildByName(stepName).visible=true;
			}
		}
		
		/**
		 * 根据箭头名字 移除 箭头 从自己的父容器中(针对那些没有加入到新手指导层的)
		 * @param arrowName
		 * @param isDelete 是否彻底删除
		 * @param removeObj 移除对象的父容器
		 */		
		private function removeArrowByArrowNameInParent(arrowName:String,isDelete:Boolean=false,removeObj:DisplayObjectContainer=null):void
		{
			if(null==removeObj || null==removeObj.getChildByName(arrowName))
			{
				return;
			}
			if(isDelete)
			{
				removeObj.removeChild(removeObj.getChildByName(arrowName));
//				delete this.arrowObj[arrowName];
			}else{
				removeObj.getChildByName(arrowName).visible=false;
			}
		}
		
		/**
		 * 是否拥有此权限 
		 * @param power
		 * @return 
		 */		
		public function isHavePower(power:int):Boolean
		{
			var flag:Boolean=true;
			if(null==GD_Player.instance.playPowerObj[power] || 0==GD_Player.instance.playPowerObj[power])
			{
				flag=false;
			}
			return flag;
		}
		
		public function getLeftArrow():DisplayObject
		{
			return new (ApplicationDomain.currentDomain.getDefinition("newGuideLeft") as Class);
		}
		
		public function getRightArrow():DisplayObject
		{
			return new (ApplicationDomain.currentDomain.getDefinition("newGuideRight") as Class);
		}
		
		public function getUpArrow():DisplayObject
		{
			return new (ApplicationDomain.currentDomain.getDefinition("newGuideUp") as Class);
		}
		
		public function getDownArrow():DisplayObject
		{
			return new (ApplicationDomain.currentDomain.getDefinition("newGuideDown") as Class);
		}
		
		/**
		 * 是否是新手任务 
		 * @param missionType
		 * @return 
		 */		
		public function isNewGuideMis(missionType:Number):Boolean
		{
			var flag:Boolean=false;
			var misStr:String=M_ConfigData.instance.newGuideMission;
			var tmpArr:Array=misStr.split(",");
			for(var i:int=0;i<tmpArr.length;i++)
			{
				if(missionType==tmpArr[i])
				{
					flag=true;
					break;
				}
			}
			return flag;
		}
		
	}
}
